package com.portal.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.portal.constant.RedisConst;
import com.portal.model.entity.BookType;
import com.portal.service.BookTypeService;
import com.portal.mapper.BookTypeMapper;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 61073
* @description 针对表【t_book_type】的数据库操作Service实现
* @createDate 2025-09-27 09:54:25
*/
@Service
public class BookTypeServiceImpl extends ServiceImpl<BookTypeMapper, BookType>
    implements BookTypeService{

    /**
     * @Cacheable 自动把方法返回的对象放入Redis缓存中；
     * 1、先从缓存获取数据
     * 2、没有获取到，执行方法，执行完后把方法返回的结果放入缓存中
     * 3、如果从缓存中获取到数据，不执行方法直接返回
     * @return
     */
    @Cacheable(cacheNames = RedisConst.BOOK_TYPE_LIST,keyGenerator = "keyGenerator")
    @Override
    public List<BookType> findAll() {
        return this.list();
    }
}




